package com.wenx;

import java.util.List;

public class InOrderTraversal extends AbstractTreeSorts {


    @Override
    public List<Integer> treeTraversal() {
        super.setData();
        treeTraversal(root);
        return result;
    }

    private void treeTraversal(TreeNode root) {
        if(root.getLeft() != null) {
            treeTraversal(root.getLeft());
        }
        result.add(root.getData());
        if(root.getRight() != null) {
            treeTraversal(root.getRight());
        }
    }

}
